<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>    
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<title>学生请假情况</title>
	<link href="http://libs.baidu.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet" />
	<link rel="stylesheet" href="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="http://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="http://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>

</head>
<body>

	<table class="table table-striped table-bordered">
		<thead>
			<tr style="text-align:center;">
				<td>学号</td>
				<td>姓名</td>
				<td>状态</td>
				<td>请假原因</td>
				<td>请假时间</td>
				<td>编辑</td>
			</tr>
		</thead>
		<tbody>
			<c:forEach var="user" items="${requestScope.pagemsg.lists}">
				<tr style="text-align:center;">
					<td>${user.user }</td>
					<td>${user.studentName }</td>
					<td>${user.studentState }</td>
					<td>${user.why }</td>
					<td>${user.time }</td>
					<td><input value="批准" type="button"  data-toggle="modal" data-target="#myModal" onclick="tinC(this,this.id)" /></td>
				</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="col-md-5 col-md-offset-3">
   
	   <span>第${requestScope.pagemsg.currPage }/ ${requestScope.pagemsg.totalPage}页</span>  
	   <span>总记录数：${requestScope.pagemsg.totalCount }  每页显示:${requestScope.pagemsg.pageSize}</span> <br>
	   <span>
	       <c:if test="${requestScope.pagemsg.currPage != 1}">
	           <a href="${pageContext.request.contextPath }/qjxt/main?currentPage=1">[首页]</a>  
	           <a href="${pageContext.request.contextPath }/qjxt/main?currentPage=${requestScope.pagemsg.currPage - 1}">[上一页]</a>  
	       </c:if>
	       
	       <c:if test="${requestScope.pagemsg.currPage != requestScope.pagemsg.totalPage}">
	           <a href="${pageContext.request.contextPath }/qjxt/main?currentPage=${requestScope.pagemsg.currPage + 1 }">[下一页]</a>  
	           <a href="${pageContext.request.contextPath }/qjxt/main?currentPage=${requestScope.pagemsg.totalPage}">[尾页]</a>  
	       </c:if>
      
  	</div>
	
	
	<!-- 模态框（Modal） -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
	    <div class="modal-dialog">
	        <div class="modal-content">
	            <div class="modal-header">
	                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
	                    &times;
	                </button>
	            </div>
	            <div class="modal-body">
                	<form action="<%=request.getContextPath() %>/qjxt/updata" method="post">
						学生姓名：<input id="SN" name="studentName" style="width:200px;" type="text"><br />
						请假原因：<input id="QW" type="text" name="why" style="width:200px;"  /><br />
                		请假时间：<input id="QT" type="text" name="time" style="width:200px;" /><br />
						<select name="studentState" style="width:80px;height:27px;">
							<option>正常</option>
							<option>请假</option>
						</select>
						<button class="btn btn-primary">批准</button>
					</form><br />
	            </div>
	            <div class="modal-footer">
	                <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
	            </div>
	        </div>
	    </div>
	</div>
</body>
<script src="https://cdn.staticfile.org/jquery/1.10.2/jquery.min.js"></script>
<script>
	function tinC(obj,id) {
		var td_content = $(obj).parents("tr").children("td");
		var content1 = td_content.eq(1).text();
		var content3 = td_content.eq(3).text();
		var content4 = td_content.eq(4).text();
		$("#SN").val(content1);
		$("#QW").val(content3);
		$("#QT").val(content4);
	}
</script>
</html>